/* GUI CONVERTED from resqiq.p (converter v1.75) Sat Aug 12 23:09:26 2000 */
/* resqiq.p - PRODUCTION LINE SEQUENCE INQUIRY                             */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                     */
/* All rights reserved worldwide.  This is an unpublished work.            */
/* web convert resqiq.p (converter v1.00) Fri Feb 27 10:45:02 1998 */
/* web tag in resqiq.p (converter v1.00) Fri Feb 27 10:44:41 1998 */
/*F0PN*/ /*K1K7*/ /*                                                    */
/*V8:ConvertMode=Report                                           */
/* REVISION: 7.0                                          BY: SMM *F230    */
/* REVISION: 7.0         LAST MODIFIED: 03/29/92          BY: emb *F331    */
/* Revision: 7.3         Last edit: 11/19/92              By: jcd *G339    */
/* REVISION: 7.2         LAST MODIFIED: 12/14/92          BY: emb *G468*   */
/* REVISION: 7.3         LAST MODIFIED: 04/28/93          BY: qzl *GA53*   */
/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 02/27/98   BY: *K1K7* Beena Mol       */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan      */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb               */


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

/*K1K7*/ {mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE resqiq_p_1 "Item"
/* MaxLen: Comment: */

&SCOPED-DEFINE resqiq_p_2 "Seq"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

     define variable site     like rps_site.
     define variable prline     like rps_line.
     define variable part     like rps_part.
     define variable start    like lnd_start.
/*G468*  define variable bom like lnd_bom. */
     define variable lnrate   like lnd_rate.
     define variable reldate  like rps_due_date.
/*G468*/ define variable um like pt_um.

/*K1K7* /*GA53*/ {mfdtitle.i "b+ "} */

     
/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
        site prline part start
     with frame a no-underline width 80 attr-space THREE-D /*GUI*/.

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



     /* SET EXTERNAL LABELS */
     setFrameLabels(frame a:handle).

/*G468*  form
        seq_priority column-label "No" format  ">>9"
        seq_due_date   column-label "Due Date"
        seq_qty_req  column-label "Qty"
        seq_part     column-label "Item"
        lnrate       column-label "Units!Hour" format ">>>>>>"
        lnd_prod_um         column-label "Prod UM"
        seq_start    column-label "Start"
     with frame b down width 80.
     */

     site = global_site.
/*G468*/ part = global_part.
/*G468*/ start = today.

/*K1K7*/ {wbrp01.i}

      repeat on error undo, retry:

        lnrate = 0.
/*G468*     bom    = "". */

/*K1K7*/ if c-application-mode <> 'web' then
         update site prline part start with frame a editing:

           if frame-field = "site" then do:
          /* FIND/NEXT PREVIOUS */
          {mfnp.i seq_mstr site seq_site site seq_site seq_site}.
          if recno <> ? then do:
             display seq_site @ site with frame a.
          end.
          recno = ?.
           end.
           else if frame-field = "prline" then do:
          /* FIND/NEXT PREVIOUS */
          {mfnp01.i seq_mstr prline seq_line seq_site "input site"
           seq_site}
          if recno <> ? then do:
             display seq_line @ prline with frame a.
          end.
          recno = ?.
           end.
           else if frame-field = "part" then do:
          /* FIND/NEXT PREVIOUS */
          {mfnp05.i seq_mstr seq_site
          "seq_site = input site and seq_line = input prline"
           seq_part "input part"}
          if recno <> ? then do:
             display seq_part @ part with frame a.
          end.
          recno = ?.
           end.
           else do:
          readkey.
          apply lastkey.
           end.
        end.  /* EDITING */

/*K1K7*/ {wbrp06.i &command = update &fields = "  site prline part start"
          &frm = "a"}

/*K1K7*/ if (c-application-mode <> 'web') or
/*K1K7*/ (c-application-mode = 'web' and
/*K1K7*/ (c-web-request begins 'data')) then do:

/*F331*/    find si_mstr no-lock where si_site = site no-error.
/*F331*/    if not available si_mstr then do:
/*F331*/       {mfmsg.i 708 3}
/*K1K7*/       if c-application-mode = 'web' then return.
/*F331*/       undo, retry.
/*F331*/    end.

        find first ln_mstr no-lock where ln_line = prline no-error.
        if not available ln_mstr then do:
           {mfmsg.i 8524 3}
/*K1K7*/   if c-application-mode = 'web' then return.
           undo, retry.
        end.

        find ln_mstr where ln_site = site
        and ln_line = prline no-lock no-error.
        if not available ln_mstr then do:
           {mfmsg.i 8526 3}
/*K1K7*/   if c-application-mode = 'web' then return.
           undo, retry.
        end.

/*G468*/    hide frame b.

/*K1K7*/ end.

         {mfselprt.i "terminal" 80}

/*G468*     clear frame b all. */

        for each seq_mstr no-lock where (seq_site = site )
        and (seq_line = prline)
        and (seq_part = part or part = "")
/*G468*     and (seq_start >= start or start = ?) */
/*G468*/    and (seq_due_date >= start or start = ?)
/*G468*/    use-index seq_sequence
        break by seq_site by seq_line by seq_priority
/*G468*/    with frame b:
                
/*GUI*/ {mfguichk.i } /*Replace mfrpchk*/
                     /*G339*/

/*G468*/       /* Changed form */
           FORM /*GUI*/ 
          seq_priority column-label {&resqiq_p_2} format ">>>9.9<"
          seq_due_date
          seq_part     column-label {&resqiq_p_1}
          seq_qty_req
          um
          ln_rate
          seq_start
           with STREAM-IO /*GUI*/  frame b width 80 no-attr-space.

           /* SET EXTERNAL LABELS */
           setFrameLabels(frame b:handle).

           lnrate = 0.
           find last lnd_det no-lock where lnd_site = seq_site
           and lnd_line = seq_line
           and lnd_part = seq_part
           and seq_due_date >= lnd_start no-error.
/*G468*        if available lnd_det then do:
          lnrate = lnd_rate.
          if lnd_rate = 0 then do:
             find ln_mstr no-lock where ln_line = lnd_line
             and ln_site = lnd_site no-error.
             if available ln_mstr then lnrate = ln_rate.
          end.
           end. */

/*G468*/       if available lnd_det then lnrate = lnd_rate.

           if lnrate = 0 then do:
          find ln_mstr no-lock where ln_line = seq_line
          and ln_site = seq_site no-error.
          if available ln_mstr then lnrate = ln_rate.
           end.

/*G468*/       find pt_mstr no-lock where pt_part = seq_part no-error.
/*G468*/       if available pt_mstr then um = pt_um.
/*G468*/       else um = "".

           display
          seq_priority
          seq_due_date
          seq_part
          seq_qty_req
          um
          lnrate
/*G468*/          @ ln_rate
/*G468*           lnd_prod_um when available lnd_det */
          seq_start
           with frame b STREAM-IO /*GUI*/ .

/*G468*        down 1 with frame b. */

        end. /* for each seq_mstr */

        {mfreset.i}
/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

        {mfmsg.i 8 1}

        if site <> "" then global_site = site.
/*GA53*/    if part <> "" then global_part = part.

     end. /* repeat */

/*K1K7*/ {wbrp04.i &frame-spec = a}
